home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-21 | 8.1 KB | 287 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWPicShp.cpp
- // Release Version: $ 1.0d1 $
- //
- // Creation Date: 4/12/94
- //
- // Copyright: © 1993, 1994 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWPICSHP_H
- #include "FWPicShp.h"
- #endif
-
- #ifndef FWGC_H
- #include "FWGC.h"
- #endif
-
- #ifndef FWDFAULT_H
- #include "FWDfault.h"
- #endif
-
- #ifndef FWBMPSHP_H
- #include "FWBmpShp.h"
- #endif
-
- #ifndef FWPRIBEB_H
- #include "FWPriDeb.h"
- #endif
- // ----- OpenDoc Includes -----
-
- #ifndef _TRNSFORM_
- #include <Trnsform.h>
- #endif
-
- //==============================================================================
- // •• RunTime Info
- //==============================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment fwgraphx
- #endif
-
- //==============================================================================
- // •• class FW_CPictShape
- //==============================================================================
-
- //------------------------------------------------------------------------------
- // FW_CPictShape::FW_CPictShape
- //------------------------------------------------------------------------------
-
- FW_CPictShape::FW_CPictShape() :
- FW_CShape()
- {
- }
-
- //------------------------------------------------------------------------------
- // FW_CPictShape::FW_CPictShape
- //------------------------------------------------------------------------------
-
- FW_CPictShape::FW_CPictShape(FW_PlatformPict platformPict) :
- FW_CShape()
- {
- #ifdef FW_BUILD_MAC
- FW_CRect rect = (*platformPict)->picFrame;
- rect.Place(0, 0);
- #endif
-
- #ifdef FW_BUILD_WIN
- FW_DEBUG_MESSAGE("Not Yet Implemented");
- #endif
-
- SetRep(new FW_CPictShapeRep(platformPict, rect));
- }
-
- //------------------------------------------------------------------------------
- // FW_CPictShape::FW_CPictShape
- //------------------------------------------------------------------------------
-
- FW_CPictShape::FW_CPictShape(FW_PlatformPict platformPict, const FW_CRect& rect) :
- FW_CShape()
- {
- SetRep(new FW_CPictShapeRep(platformPict, rect));
- }
-
- //------------------------------------------------------------------------------
- // FW_CPictShape::FW_CPictShape
- //------------------------------------------------------------------------------
-
- FW_CPictShape::FW_CPictShape(FW_CPictShapeRep* other) :
- FW_CShape(other)
- {
- }
-
- //------------------------------------------------------------------------------
- // FW_CPictShape::FW_CPictShape
- //------------------------------------------------------------------------------
-
- FW_CPictShape::FW_CPictShape(const FW_CPictShape& other) :
- FW_CShape() // the compiler refuse to take FW_CShape(other) ?????
- {
- SetRep(other.GetRep());
- }
-
- //------------------------------------------------------------------------------
- // FW_CPictShape::operator=
- //------------------------------------------------------------------------------
-
- FW_CPictShape& FW_CPictShape::operator=(const FW_CPictShape& other)
- {
- SetRep(other.GetRep());
- return *this;
- }
-
- //------------------------------------------------------------------------------
- // FW_CPictShape::operator=
- //------------------------------------------------------------------------------
-
- FW_CPictShape& FW_CPictShape::operator=(FW_CPictShapeRep* other)
- {
- SetRep(other);
- return *this;
- }
-
- //------------------------------------------------------------------------------
- // FW_CPictShape::operator FW_CBitmapShape
- //------------------------------------------------------------------------------
-
- FW_CPictShape::operator FW_CBitmapShape() const
- {
- FW_CBitmapShape bitmap(((FW_CPictShapeRep*)GetRep())->GetPlatformPict(),
- ((FW_CPictShapeRep*)GetRep())->GetRectangle());
- return bitmap;
- }
-
- //==============================================================================
- // •• class FW_CPictShapeRep
- //==============================================================================
-
- //------------------------------------------------------------------------------
- // • FW_CPictShapeRep::FW_CPictShapeRep
- //------------------------------------------------------------------------------
-
- FW_CPictShapeRep::FW_CPictShapeRep() :
- FW_CBoundedShapeRep(gGraphicGlobales.gPicture, FW_CRect(0,0,0,0)),
- fPlatformPict(NULL)
- {
- }
-
- //------------------------------------------------------------------------------
- // • FW_CPictShapeRep::FW_CPictShapeRep
- //------------------------------------------------------------------------------
-
- FW_CPictShapeRep::FW_CPictShapeRep(FW_PlatformPict platformPict, const FW_CRect& rect) :
- FW_CBoundedShapeRep(gGraphicGlobales.gPicture, rect),
- fPlatformPict(platformPict)
- {
- }
-
- //------------------------------------------------------------------------------
- // • FW_CPictShapeRep::~FW_CPictShapeRep
- //------------------------------------------------------------------------------
-
- FW_CPictShapeRep::~FW_CPictShapeRep()
- {
- #ifdef FW_BUILD_MAC
- if (fPlatformPict)
- ::KillPicture(fPlatformPict);
- fPlatformPict = NULL;
- #endif
-
- #ifdef FW_BUILD_WIN
- FW_DEBUG_MESSAGE("Not Yet Implemented");
- #endif
- }
-
- //------------------------------------------------------------------------------
- // • FW_CPictShapeRep::Draw
- //------------------------------------------------------------------------------
-
- void FW_CPictShapeRep::Draw(FW_CGraphicContext* graphicContext)
- {
- FW_ShapeFills shapeFill = GetShapeFill();
-
- if (fPlatformPict == NULL || shapeFill == FW_kNullShape)
- return;
-
- FW_SPlatformRect rect = graphicContext->AsPlatformRect(fRect);
-
- #ifdef FW_BUILD_MAC
- ::DrawPicture(fPlatformPict, &rect);
- #endif
-
- #ifdef FW_BUILD_WIN
- FW_DEBUG_MESSAGE("Not Yet Implemented");
- #endif
- }
-
- //------------------------------------------------------------------------------
- // • FW_CPictShapeRep::SetAsDefault
- //------------------------------------------------------------------------------
-
- void FW_CPictShapeRep::SetAsDefault() const
- {
- SetDefaultProperties(gGraphicGlobales.gPicture);
- }
-
- //------------------------------------------------------------------------------
- // • FW_CPictShapeRep::HitTest
- //------------------------------------------------------------------------------
-
- FW_HitTestPart FW_CPictShapeRep::HitTest(const FW_CPoint& test) const
- {
- return FW_kOutside;
- }
-
- //------------------------------------------------------------------------------
- // • FW_CPictShapeRep::SetPlatformPict
- //------------------------------------------------------------------------------
-
- void FW_CPictShapeRep::SetPlatformPict(FW_PlatformPict platformPict)
- {
- if (fPlatformPict)
- #ifdef FW_BUILD_MAC
- ::KillPicture(fPlatformPict);
- #endif
- #ifdef FW_BUILD_WIN
- #endif
- fPlatformPict = platformPict;
- Changed();
- }
-
- //------------------------------------------------------------------------------
- // • FW_CPictShapeRep::Flatten
- //------------------------------------------------------------------------------
-
- void FW_CPictShapeRep::Flatten(FW_CWritableStream& stream)
- {
- FW_CBoundedShapeRep::Flatten(stream);
-
- #ifdef FW_BUILD_MAC
- // ATTENTION: Temporary Code
- long picSize = ::GetHandleSize((Handle)fPlatformPict);
- stream << picSize;;
- ::HLock((Handle)fPlatformPict);
- stream.Write(*fPlatformPict, picSize);
- ::HUnlock((Handle)fPlatformPict);
- #endif
- #ifdef FW_BUILD_WIN
- #endif
- }
-
- //------------------------------------------------------------------------------
- // • FW_CPictShapeRep::Unflatten
- //------------------------------------------------------------------------------
-
- void FW_CPictShapeRep::Unflatten(FW_CReadableStream& stream)
- {
- FW_CBoundedShapeRep::Unflatten(stream);
-
- #ifdef FW_BUILD_MAC
- // ATTENTION: Temporary Code
- long picSize;
- stream >> picSize;
- if (fPlatformPict)
- ::KillPicture(fPlatformPict);
- fPlatformPict = (FW_PlatformPict)::NewHandle(picSize);
- ::HLock((Handle)fPlatformPict);
- stream.Read(*fPlatformPict, picSize);
- ::HUnlock((Handle)fPlatformPict);
- #endif
- #ifdef FW_BUILD_WIN
- #endif
- }
-
- //------------------------------------------------------------------------------
- // • FW_CPictShapeRep::Copy
- //------------------------------------------------------------------------------
-
- FW_CPictShape FW_CPictShapeRep::Copy() const
- {
- FW_DEBUG_MESSAGE("Not Yet Implemented");
- FW_CPictShape pictShape;
- return pictShape;
- }
-